package com.epin.base.enums.commons;

/**
 * <p>伪外键约束类型枚举</p>
 * 
 * 
 * @author fujiajn
 * @since 2017-09-09
 *
 */
public enum ForeignKeyEnum {
	
	/**
	 * RESTRICT
	 */
	RESTRICT(1, "RESTRICT"),
	/**
	 * NOACTION
	 */
	NOACTION(2, "NOACTION"),
	/**
	 * CASCADE
	 */
	CASCADE(3, "CASCADE"),
	/**
	 * SETNULL
	 */
	SETNULL(4, "SETNULL");
	
	private int value;
	private String message;
	
	private ForeignKeyEnum(int value, String message){
		this.value = value;
		this.message = message;
	}
	
	public int val(){
		return this.value;
	}
	
	public String msg(){
		return this.message;
	}
	
	
	public static ForeignKeyEnum getStyle(int value) {
		for (ForeignKeyEnum e : ForeignKeyEnum.values()) {
			if (e.value == value) {
				return e;
			}
		}
		
		return null;
	}
}
